<template>
	<view v-if="info" class="page page-brand page-footprint">
		<!-- 已点亮酒店 -->
		<view class="box-shadow brand" style="margin-top: 60rpx;">
			<view class="title flex-row-center">
				<view class="inner">已点亮<text class="yellow">{{info.yes}}</text>种品牌<text class="line">|</text>累计<text class="yellow">{{info.night}}</text>间夜</view>
			</view>
			<view class="list flex-row-between flex-wrap">
				<block v-for="(item, index) in dataList1" :key="index">
					<view class="item flex-column-center" @click="goNext('/pages/hotel/hotelDetail?id=' + item.id)">
						<view v-if="index == 0" class="tag">最新</view>
						<view class="logo bg-cover" :style="{backgroundImage: 'url(' + imgPath + item.logo + ')'}"></view>
						<view class="font13 name">{{item.name}}</view>
						<view>
							<text class="font13 font-666666">累计：</text>
							<text class="font16 font-assist font-b">{{item.light}}</text>
							<text class="font13 font-assist">间夜</text>
						</view>
					</view>
				</block>
			</view>
		</view>
		<!-- 待点亮酒店 -->
		<view class="box-shadow brand brand-wait">
			<view class="title flex-row-center">
				<view class="inner">待点亮品牌<text class="yellow">({{info.no}})</text></view>
			</view>
			<view class="list flex-row-between flex-wrap">
				<block v-for="(item, index) in dataList2" :key="index">
					<view class="item flex-column-center" @click="goNext('/pages/hotel/hotelDetail?id=' + item.id)">
						<view class="logo bg-cover" :style="{backgroundImage: 'url(' + imgPath + item.logo + ')'}"></view>
						<view class="font13 name font-999999">{{item.name}}</view>
					</view>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgPath: this.$Config.http_static, // 图片头
				info: null,
				dataList1: [], // 已点亮
				dataList2: [], // 待点亮
			}
		},
		onLoad: function(){
			this.$Http({
				url: 'footPrint',
				token: true,
				load: true
			}).then(res => {
				if (res.code == 1) {
					this.info = res.data.info
					this.dataList1 = res.data.info.hotel_yes
					this.dataList2 = res.data.data
				}
			});
		},
		methods: {
			// 路由跳转: tag默认false,tag=true跳到tabBar页面
			goNext(url, tag) {
				if (tag) {
					uni.switchTab({ url: url });
				} else {
					uni.navigateTo({ url: url });
				}
			}
		}
	}
</script>

<style lang="less">
	@import url("style.less");
</style>
